namespace PDUConverter.SmartMessaging
{
    /// <summary>
    /// Implements the base for an information element.
    /// </summary>
    public abstract class InformationElement
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="T:GsmComm.PduConverter.SmartMessaging.InformationElement" /> class.
        /// </summary>
        /// <param name="identifier">The Information Element Identifier (IEI).</param>
        protected InformationElement(byte identifier)
        {
            Identifier = identifier;
        }

        /// <summary>
        /// In the derived classes, returns the byte array equivalent of this instance.
        /// </summary>
        /// <returns>The byte array.</returns>
        public abstract byte[] ToByteArray();
        /// <summary>
        /// In the derived classes, returns the string equivalent of this instance.
        /// </summary>
        /// <returns>The string.</returns>
        public override string ToString()
        {
            return Calc.IntToHex(this.ToByteArray());
        }

        /// <summary>
        /// Gets the Information Element Identifier (IEI).
        /// </summary>
        public byte Identifier { get; private set; }
    }
}